package org.dtrd.modules.achievement.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.achievement.entity.po.DtrdEntRdSigninAchievement;

/**
 * 成就信息
 *
 * @author 萧
 * @date:2021-08-30 10:37 下午
 **/
@Data
@ApiModel(value = "成就信息")
public class Achievement {

    private Integer patientId;

    @ApiModelProperty(value = "日期", example = "yyyy-M-d")
    private String date;

    @ApiModelProperty(value = "得分")
    private Integer score;

    public Achievement parseFromPO(DtrdEntRdSigninAchievement record) {
        patientId = record.getPatientId();
        score = record.getAchievementScore();
        if (record.getRecordDate() != null) {
            date = DateUtils.formatDate(record.getRecordDate());
        }
        return this;
    }
}
